<?php
/**
 * Created by PhpStorm.
 * User: ari
 * Date: 12/23/2014
 * Time: 1:16 PM
 */
namespace BC\User\Grant\DB;
use CPath\Build\IBuildable;
use CPath\Build\IBuildRequest;
use CPath\Data\Schema\PDO\PDOTableClassWriter;
use CPath\Data\Schema\TableSchema;

/**
 * Class GrantUserEntry
 * @table grant_user
 */
class GrantUserEntry implements IBuildable
{
	/**
	 * @column CHAR(40)
	 * @index --name grant_user_lookup
	 * @unique --name grant_user_unique
	 * @select
	 * @insert
	 */
	protected $user_fingerprint;

	/**
	 * @column CHAR(40)
	 * @unique --name grant_user_unique
	 * @select
	 * @insert
	 */
	protected $grant_fingerprint;

	// Static

	/**
	 * Handle this request and render any content
	 * @param IBuildRequest $Request the build request inst for this build session
	 * @return void
	 * @build --disable 0
	 * Note: Use doctag 'build' with '--disable 1' to have this IBuildable class skipped during a build
	 */
	static function handleBuildStatic(IBuildRequest $Request) {
		$Schema      = new TableSchema(__CLASS__);
		$ClassWriter = new PDOTableClassWriter(new GrantDB(), __NAMESPACE__ . '\GrantUserTable', __CLASS__);
		$Schema->writeSchema($ClassWriter);
	}
}